package ObjectCompare;

import ObjectCompare.comparator.NameComparator;

import java.util.Set;
import java.util.TreeSet;

/**
 * 策略设计模式
 */
public class TreeSetTest {

    public static void main(String[] args) {
        Set<User> users = new TreeSet<>(new NameComparator());
        users.add(new User(18, "Fuck"));
        users.add(new User(22, "Tom"));
        users.add(new User(20, "Alice"));
        System.out.println(users);
    }
}

